package com.situ.firmadmin.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import com.situ.firmadmin.mapper.LoginLogMapper;
import com.situ.firmadmin.pojo.LoginLog;
import com.situ.firmadmin.pojo.query.LoginLogQuery;
import com.situ.firmadmin.service.ILoginLogService;
import com.situ.firmadmin.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LoginLogServiceImpl implements ILoginLogService {
    @Autowired
    private LoginLogMapper loginLogMapper;

    @Override
    public void add(LoginLog loginLog) {
        loginLogMapper.add(loginLog);
    }

    @Override
    public PageResult list(LoginLogQuery loginLogQuery) {
        PageHelper.startPage(loginLogQuery.getPage(), loginLogQuery.getLimit());
        List<LoginLog> list=loginLogMapper.list(loginLogQuery);
        PageInfo pageInfo=new PageInfo(list);
        int totalCount=(int)pageInfo.getTotal();
        return new PageResult(0,"",totalCount,list);
    }

    @Override
    public LoginLog selectById(Integer id) {
        return loginLogMapper.selectById(id);
    }

    @Override
    public void deleteSelected(Integer[] ids) {
        loginLogMapper.deleteSelected(ids);
    }

    @Override
    public void deleteById(Integer id) {
        loginLogMapper.deleteById(id);
    }

    @Override
    public void deleteAll() {
        loginLogMapper.deleteAll();
    }
}
